Nested Skip Lists

I had a link to a forum that described use of nested skip lists but I'm not able to see the full thread.  So, really was looking for a way to have a skip list with values being references to a number of 2nd-level skip lists.  Hoping to get some quick examples on creating the 1st level skip list of references and then looping through this 1st level skip list and working on the 2nd-level skip list key/values.

Thanks in advance!


tmraap - Wed May 01 12:06:18 EDT 2013

Re: Nested Skip Lists
llandale - Wed May 01 12:46:14 EDT 2013

You mean something like this?:

  • Skip skpObj = create(); skpText = create(), skpAlloc = create()
  • int AbnNo
  • string Text, Alloc
  • for o in mod do
  • {     AbsNo = o."Absolute Number"
    • put(skpObj, o, AbsNo)
    • put(skpText, AbsNo, o."Object Text" "")
    • put(skpAlloc, AbsNo, o."Allocation" "")
  • }
  • for AbsNo in skpObj do
  • {     o = (Object key skpObj)
    • Text = find(skpText, AbsNo)
    • Alloc = find(skpAlloc, AbsNo)
  • }

-Louie

Re: Nested Skip Lists
Adamarla - Thu May 02 10:09:10 EDT 2013

 

Another Example:

 

Module oModule = current()
Skip oObjectSkip = create()
 
// Populate
Object oObject
for oObject in entire(oModule) do
{
Skip oAttributeSkip = createString()
put(oAttributeSkip, "Object Heading", oObject."Object Heading" "")
put(oAttributeSkip, "Object Text", oObject."Object Text" "")
// etc
 
// Nest it
int iAbsNo = oObject."Absolute Number"
put(oObjectSkip, iAbsNo, oAttributeSkip)
}
 
// Print
Skip oAttrSkip
for oAttrSkip in oObjectSkip do
{
int iAbsno = (key(oObjectSkip)) int
print("Object: " iAbsno "\n")
 
string sValue
for sValue in oAttrSkip do
{
string sAttributeName = (key(oAttrSkip)) string
print(sAttributeName "\t: " sValue "\n")
}
}
 
// Delete Nested Skips
for oAttrSkip in oObjectSkip do
{
delete(oAttrSkip)
}
delete(oObjectSkip)

Re: Nested Skip Lists
tmraap - Thu May 02 10:32:18 EDT 2013

llandale - Wed May 01 12:46:14 EDT 2013

You mean something like this?:

  • Skip skpObj = create(); skpText = create(), skpAlloc = create()
  • int AbnNo
  • string Text, Alloc
  • for o in mod do
  • {     AbsNo = o."Absolute Number"
    • put(skpObj, o, AbsNo)
    • put(skpText, AbsNo, o."Object Text" "")
    • put(skpAlloc, AbsNo, o."Allocation" "")
  • }
  • for AbsNo in skpObj do
  • {     o = (Object key skpObj)
    • Text = find(skpText, AbsNo)
    • Alloc = find(skpAlloc, AbsNo)
  • }

-Louie

Louie,

I was thinking more in the lines of the following.  Don't dwell too much on syntax just trying to capture concept.  Really data structure would be (TargetModule reference to a Skip List, Skip List containing Source Object Key with Value of Target Objects to Link).  If this doesn't work, I'll just use Skip list with some string format in the Skip values.

Skip skpTargs = create();

for o in srcmod do

{ string TraceStr = o."TraceAttr"

string SrcObjID = o."Absolute Number"

for eachEntry of split TraceAttr

string TargetObjID = //get object ID for entry

string TargetKey

{if (!find(skpTargs,TargetKey,Skpptr))

{//create a new skip for target, put pointer in skip, new skiplist for each time through

Skip SkipIf = create();

put(SkipIf,SrcObjID,TargetObjID)

put(skpTargs,TargetKey, [Pointer to SkipIf])

} else {

//Use TargetKey to get existing skip list

//Search TargetKey for SrcObjID key, append TargetObjID if exists otherwise create new SrcObjID entry

}

}

}

Thx!!

-Tim

Re: Nested Skip Lists
tmraap - Thu May 02 10:55:41 EDT 2013

Adamarla - Thu May 02 10:09:10 EDT 2013

 

Another Example:

 

Module oModule = current()
Skip oObjectSkip = create()
 
// Populate
Object oObject
for oObject in entire(oModule) do
{
Skip oAttributeSkip = createString()
put(oAttributeSkip, "Object Heading", oObject."Object Heading" "")
put(oAttributeSkip, "Object Text", oObject."Object Text" "")
// etc
 
// Nest it
int iAbsNo = oObject."Absolute Number"
put(oObjectSkip, iAbsNo, oAttributeSkip)
}
 
// Print
Skip oAttrSkip
for oAttrSkip in oObjectSkip do
{
int iAbsno = (key(oObjectSkip)) int
print("Object: " iAbsno "\n")
 
string sValue
for sValue in oAttrSkip do
{
string sAttributeName = (key(oAttrSkip)) string
print(sAttributeName "\t: " sValue "\n")
}
}
 
// Delete Nested Skips
for oAttrSkip in oObjectSkip do
{
delete(oAttrSkip)
}
delete(oObjectSkip)

Thx for the reply, this is pretty close to what I am looking for.  I'll give it a try.

Re: Nested Skip Lists
Adamarla - Thu May 02 11:00:25 EDT 2013

tmraap - Thu May 02 10:55:41 EDT 2013

Thx for the reply, this is pretty close to what I am looking for.  I'll give it a try.

You're welcome